package com.ruoyi.order.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.order.mapper.CustomerAddrMapper;
import com.ruoyi.order.domain.CustomerAddr;
import com.ruoyi.order.service.ICustomerAddrService;

import static cn.hutool.core.util.StrUtil.uuid;

/**
 * 客户地址管理Service业务层处理
 * 
 * @author lzp
 * @date 2025-01-01
 */
@Service
public class CustomerAddrServiceImpl implements ICustomerAddrService 
{
    @Autowired
    private CustomerAddrMapper customerAddrMapper;

    /**
     * 查询客户地址管理
     * 
     * @param addressId 客户地址管理主键
     * @return 客户地址管理
     */
    @Override
    public CustomerAddr selectCustomerAddrByAddressId(String addressId)
    {
        return customerAddrMapper.selectCustomerAddrByAddressId(addressId);
    }

    public List<CustomerAddr> selectCustomerAddrByCustomerId(String customerId)
    {
        return customerAddrMapper.selectCustomerAddrByCustomerId(customerId);
    }

    /**
     * 查询客户地址管理列表
     * 
     * @param customerAddr 客户地址管理
     * @return 客户地址管理
     */
    @Override
    public List<CustomerAddr> selectCustomerAddrList(CustomerAddr customerAddr)
    {
        return customerAddrMapper.selectCustomerAddrList(customerAddr);
    }

    /**
     * 新增客户地址管理
     * 
     * @param customerAddr 客户地址管理
     * @return 结果
     */
    @Override
    public int insertCustomerAddr(CustomerAddr customerAddr)
    {
        customerAddr.setAddressId(uuid());
        return customerAddrMapper.insertCustomerAddr(customerAddr);
    }

    /**
     * 修改客户地址管理
     * 
     * @param customerAddr 客户地址管理
     * @return 结果
     */
    @Override
    public int updateCustomerAddr(CustomerAddr customerAddr)
    {
        return customerAddrMapper.updateCustomerAddr(customerAddr);
    }

    /**
     * 批量删除客户地址管理
     * 
     * @param addressIds 需要删除的客户地址管理主键
     * @return 结果
     */
    @Override
    public int deleteCustomerAddrByAddressIds(String[] addressIds)
    {
        return customerAddrMapper.deleteCustomerAddrByAddressIds(addressIds);
    }

    /**
     * 删除客户地址管理信息
     * 
     * @param addressId 客户地址管理主键
     * @return 结果
     */
    @Override
    public int deleteCustomerAddrByAddressId(String addressId)
    {
        return customerAddrMapper.deleteCustomerAddrByAddressId(addressId);
    }

    @Override
    public void deleteCustomerAddr(CustomerAddr customerAddr) {
        customerAddrMapper.deleteCustomerAddr(customerAddr);
    }

    @Override
    public CustomerAddr selectCustomerAddrByCustomerIdAndAddressId(String customerId, String addressId) {
        return customerAddrMapper.selectCustomerAddrByCustomerIdAndAddressId(customerId, addressId);
    }
}
